include([], 
function(){
	
	declare('root')

	orientation = null;
	orientationChangedListenerSet = [];
	
	PORTRAIT = "portrait";
	LANDSCAPE = "landscape";
	
	canvasMask.height = window.innerHeight - 30;
	canvasMask.width = window.innerWidth - 40;
	
	touchMask.height = window.innerHeight;
	touchMask.width = window.innerWidth;
	
	$(function(){
		
		onOrientationChanged(getOrientation());
		
		$('body').bind('orientationchange', function(event){
			onOrientationChanged(getOrientation());
		});
		/*
		_iscroll = new iScroll('designer-body', {
			hScroll      :true
			, vScroll    :true
			, hScrollbar : false
			, vScrollbar : false
			, hideScrollbar : false
			, zoom : false
			, zoomMin : 0.20
		});
		
		_toolscroll = new iScroll('toolbar-body', {
			hScroll : false
			,vScroll : true
			, hScrollbar : false
			, vScrollbar : true
			, hideScrollbar : false
			, zoom : false
		});
		*/
	});
	
	getOrientation = function(){
		if( window.orientation == 0 || window.orientation == 180){
			return PORTRAIT;
		}else{
			return LANDSCAPE;
		}
	}
	
	onOrientationChanged = function(ori){
		$(function(){
			window.scrollTo(1,1);
			var i =0;
			for(i=0; i<orientationChangedListenerSet.length;i++){
				var listener = orientationChangedListenerSet[i];
				listener[0](ori, listener[1]);
			}			
		})
	}
	
	addOrientationChangedListener = function(listener, scope){
		orientationChangedListenerSet.push([listener, scope]);
		listener(orientation, scope);	
	}
});